<template>
    <view class="details">
      <view class="ul">
        <view>
			<image :src="initData.image"   mode="widthFix" class="img" />
        </view>
        <view>
          <text class="text">商品名称：</text>{{initData.goodsName}}
        </view>
        <view>
          <text class="text">购买人姓名：</text>{{initData.buyer}}
        </view>
        <view>
          <text class="text">花费积分：</text>{{initData.amount}}
        </view>
		<view>
		  <text class="text">商品积分：</text>{{initData.goodsPoint}}
		</view>
        <view>
          <text class="text">兑换数量：</text>{{initData.count}}
        </view>
		<view>
		  <text class="text">收货人姓名：</text>{{initData.receiverName}}
		</view>
		<view>
		  <text class="text">收货人电话：</text>{{initData.receiverMobile}}
		</view>
		<view>
		  <text class="text">收货人地址：</text>{{initData.receiverAddress}}
		</view>
		
		<view>
		  <text class="text">创建时间：</text>{{initData.createdTime}}
		</view>
      </view>
    </view>
</template>

<script>

export default {
	data() {
		return {
			initData: ''
			
		};
	},
	onPageScroll: function(e) {
		//nvue暂不支持滚动监听，可用bindingx代替
		if (e.scrollTop > 200) {
			this.is_go_top = true;
		} else {
			this.is_go_top = false;
		}
	},
	onLoad(option) {
		if(option.detail){
			this.initData=JSON.parse(option.detail) 
			console.log(this.initData)
		}
	},
	mounted() {
		
		this.getDate()
	},
	methods: {
		getDate() {
			var obj={id:this.id}
			commoditydetails.initData(obj)
				.then(res => {
					this.initData = res.data;
					this.initData.image=this.imgCDNUrl + this.initData.image;
					var sku=[];
					if(this.initData.productSkuDesp){
						sku=this.initData.productSkuDesp.split(",");
					}
					console.log(this.initData.productSkuDesp);
					console.log(sku);
					this.initData.sku=sku;
					this.initData.desp=this.initData.orderFrom.desp;
					console.log(this.initData);
				})
				.catch(err => {
					console.log(new Error('请检查网络后重试'));
				});
		}
		
	}
};
</script>
<style lang="less" scoped>
	page {
		background: #ffffff;
	}
	.details{
		padding: 20rpx;
		.img{
			width: 100%;
			border: 1px solid #EFEFF4;
		}
		.ul{
			line-height: 72rpx;
			font-size: 24rpx;
			.text{
				display: inline-block;
				width: 150rpx;
				text-align-last: justify;
			}
		}
	}
	
</style>
